using UnityEngine;
using System.Collections;

public class SelfDestructs : MonoBehaviour {

	public float lifeSpan = 1f;
	public bool randomize = false;

	void Start() {
		if(randomize) {
			lifeSpan = Random.Range(lifeSpan, lifeSpan*2f);
		}
	}

	// Update is called once per frame
	void Update () {
		lifeSpan -= Time.deltaTime;

		if(lifeSpan <= 0) {
			Destroy (gameObject);
		}
	}
}
